home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oh!X 2000 Spring
/
Oh!X 2000 Spring Special CD-ROM (Japan) (Part 2).7z
/
Oh!X 2000 Spring Special CD-ROM (Japan) (Part 2).bin
/
DXF
/
samples
/
multimedia
/
dplay
/
src
/
duel
/
util.cpp
< prev
Wrap
C/C++ Source or Header
|
1999-03-09
|
2KB
|
65 lines
//-----------------------------------------------------------------------------
// File: Util.cpp
//
// Desc: Misc routines
//
// Copyright (C) 1995-1999 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include "duel.h"
#include <stdlib.h>
//-----------------------------------------------------------------------------
// Name: randInt()
// Desc: Returns a random integer in the specified range
//-----------------------------------------------------------------------------
int randInt( int low, int high )
{
int range = high - low;
int num = rand() % range;
return( num + low );
}
//-----------------------------------------------------------------------------
// Name: randDouble()
// Desc: Returns a random double in the specified range
//-----------------------------------------------------------------------------
double randDouble( double low, double high )
{
double range = high - low;
double num = range * (double)rand()/(double)RAND_MAX;
return( num + low );
}
//-----------------------------------------------------------------------------
// Name: dtrace()
// Desc: Diagnostic trace to OutputDebugString() (UNICODE supported)
//-----------------------------------------------------------------------------
VOID dtrace( TCHAR* strFormat, ... )
{
int offset = 0;
TCHAR strBuf[256];
va_list ap;
va_start( ap, strFormat );
offset = wsprintf( strBuf, TEXT("DUEL: ") );
offset += wvsprintf( strBuf+offset, strFormat, ap );
OutputDebugString( strBuf );
va_end( ap );
}